package com.hu.zhcc.shiro.controller;


import com.hu.zhcc.shiro.entity.tj.VipTj;
import com.hu.zhcc.shiro.service.Tj_DlsettingService;
import com.hu.zhcc.shiro.service.Tj_TOrdersettingService;
import com.hu.zhcc.shiro.service.Tj_VipsettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 预约设置表 前端控制器
 * </p>
 *
 * @author tj
 * @since 2021-06-30
 */
@RestController
@RequestMapping("/tjtOrdersetting")
public class TjTOrdersettingController {
    @Autowired
    private Tj_TOrdersettingService tjTOrdersettingService;//预约设置表
    @Autowired
    private Tj_VipsettingService tj_vipsettingService;//会员设置表
    @Autowired
    private Tj_DlsettingService tj_dlsettingService;//登录设置表

    @GetMapping("/{nf}")
    public List<VipTj> queryAll(@PathVariable("nf") String nf){
        System.out.println(nf);
        String s=null;
        String s1=null;
        String t=null;
        String t2=null;
        String t3=null;
        List<VipTj> list=new ArrayList<>();
        for(int i=1;i<=12;i++) {
            if (i < 10) {
                s = "0" + i;
            } else {
                s = String.valueOf(i);
            }
            s1 = nf + "-" + s + "%";
            String s2 = nf + "-" + s;
            System.out.println(s);
            System.out.println(nf + "年" + s + "月");
            System.out.println(s1);
            t2 = tj_vipsettingService.queryLikeVip(s1);
            t3 = tj_dlsettingService.queryLikeDl(s1);
            t = tjTOrdersettingService.queryLikeDate(s1);
            if(t==null){
                t= String.valueOf(0);
            }
            if(t2==null){
                t2= String.valueOf(0);
            }
            if(t3==null){
                t3= String.valueOf(0);
            }
            VipTj v=new VipTj(s2,t,t2,t3);
            list.add(v);
        }
        for(VipTj i2:list){
            System.out.println(i2);
        }
        return list;
   }
}

